package com.twq.collection.framework

import scala.collection.immutable.HashMap
import scala.collection.{LinearSeq, SortedSet}

/**
 * Created by tangweiqun on 2017/12/10.
 */
object Consistency {
  def main(args: Array[String]): Unit = {
    //1、构造集合的统一性
    Traversable(1, 2, 3)
    Iterable("x", "y", "z")
    Map("x" -> 24, "y" -> 25, "z" -> 26)
    Set(Color.Red, Color.Green, Color.Blue)
    SortedSet("hello", "world")
    scala.collection.mutable.Buffer("x", "y", "z")
    IndexedSeq(1.0, 2.0)
    LinearSeq("a", "b", "c")

    List(1, 2, 3)
    HashMap("x" -> 24, "y" -> 25, "z" -> 26)

    //2、toString方法的统一
    println(List(1, 2, 3))
    println(HashMap("x" -> 24, "y" -> 25, "z" -> 26))


    //3、API的统一
    List(1, 2, 3) map (_ + 1)
    Set(1, 2, 3) map (_ * 2)
  }
}

object Color extends Enumeration {
  val Red = Value("RED")
  val Green = Value
  val Blue = Value
}
